home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
-
- cRocket::cRocket(int _x, int _y, fix angle, cGameObject *_owner)
- : cWeapon(_x, _y, rocket, angle == (fix)0? "MOVING RIGHT":angle == (fix)64? "MOVING UP":"MOVING LEFT")
- {
- // Set speed
-
- set_angular_speed(ROCKET_SPEED, angle);
- set_angular_acceleration(ROCKET_ACC, angle);
-
- // Set other
-
- owner = _owner;
- not_owner_timeout = 2 * sec;
-
- push_moving_direction = FALSE;
-
- made_trail = sec/10 + rnd(sec/4);
- }
-
- cRocket::~cRocket()
- {
- }
-
- int cRocket::control()
- {
- // Create trail
-
- if (!low_detail_level && !made_trail)
- {
- new cEffect (x, y, orig, "TRAIL");
-
- made_trail = sec/10 + rnd(sec/4);
- }
-
- // Move
-
- cWeapon::control();
-
- // Check if we hit something
-
- if (explode || check_radial_hit_one(circle_bounds, TRUE) || !x_on_screen())
- {
- not_owner_timeout = 0;
-
- check_radial_hit_more(&cCircle(0, 0, ROCKET_RADIUS));
-
- return FALSE;
- }
-
- // Kill when off screen
-
- return on_screen();
- }
-